#include <stdio.h>  
  
int main(void) {  
    char c0[15], x;  
    int i = 0, c[15];  
    if (scanf("%c", &c0[i++]));  
    getchar();  
    for (; i < 6; i++)  
        if (scanf("%c", &c0[i]));  
    getchar();  
    for (; i < 11; i++)  
        if (scanf("%c", &c0[i]));  
    for (int i = 0; i < 11; i++)  
        c[i] = c0[i] - '0';  
    int ans = (c[0] + c[2] + c[4] + c[6] + c[8] + c[10]) * 3 + c[1] + c[3] + c[5] + c[7] + c[9];  
    ans = (ans - 1) % 10;  
    printf("%d\n", 9 - ans);  
    return 0;  
}  